Emit OSC 8 terminal hyperlinks from WriteLink via Spectre Markup#133
Merged
Conversation
Copilot
AI
changed the title
[WIP] Consider emitting OSC 8 terminal hyperlinks via Markup link tag
Emit OSC 8 terminal hyperlinks from WriteLink via Spectre Markup
May 15, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #133 +/- ##
==========================================
+ Coverage 95.71% 95.74% +0.03%
==========================================
Files 29 29
Lines 1635 1647 +12
Branches 172 175 +3
==========================================
+ Hits 1565 1577 +12
Misses 46 46
Partials 24 24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
boxofyellow
reviewed
May 15, 2026
Co-authored-by: boxofyellow <54955040+boxofyellow@users.noreply.github.com>
d1d66d0 to
f67e96e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ Enhancement
Inline links rendered by
ConsoleRendererBase.WriteLink(covering bothLinkInlineandAutolinkInline) now emit Spectre.Console's[link=...]...[/]markup, producing OSC 8 terminal hyperlinks in capable terminals. Previously links were only discoverable via the post-render numbered menu.Implementation approach:
DisplayOptions.UseTerminalHyperlinks— new opt-outbool(defaulttrue); added toClone().ConsoleRendererBase.WriteLink— when the option is enabled and the URL is non-empty, wraps the emitted link text with[link={Markup.Escape(url)}]...[/]. URL is escaped so URLs containing[/]don't break Spectre's markup parser. No-op when URL is empty (e.g.[](path)reference-style cases) to avoid emitting an empty hyperlink target.RendererTestsexercising default-on, opt-out, autolink wrapping, bracketed-URL escaping, andClone()preservation. They use aTestConsolewithEmitAnsiSequences = trueandProfile.Capabilities.Links = trueto assert on the OSC 8 sequences directly.Existing
linkInline/autolinkInline/bracketEscapinggolden fixtures required no updates:TestConsole.Outputstrips the new markup unless link capabilities are explicitly enabled, so the plain-text layout fixtures are unaffected.